from sqlalchemy.ext.asyncio import AsyncAttrs, async_sessionmaker, create_async_engine
from sqlalchemy.orm import DeclarativeBase

from forward.config import get_settings

database_url = get_settings().database_url

async_engine = create_async_engine(
    database_url,
)
AsyncSessionLocal = async_sessionmaker(
    autocommit=False, autoflush=False, bind=async_engine
)


class Base(AsyncAttrs, DeclarativeBase):
    pass
